spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

How to query XML with complex types


I need to return the id from the element for all nodes that have a "Y" in the elements Item3 through Item3B.

The right answer depends on the exact "rules" for selecting nodes. It's not clear whether you are always looking for Item3 through Item3B or if they are just examples of the rule. I also assume that by "nodes have a 'Y' in the elements" you mean they have an attribute value wich equals "Y".

If you are interested in exactly three element nodes with exactly the names "Item3", "Item3A" and "Item3B", and if the "Y" value can be on any attribute, use

//*[self::Item3 or self::Item3A or
self::Item3B][@* = 'Y']

Else, if the rule only says that element names must start with "Item3", use

//*[starts-with(name(),'Item3')][@* =
'Y']

If there are namespaces in your input XML document, it would be safer to use the local-name() function instead of name().

It seems you are also trying to match attributes that start with a certain string:

//*[starts-with(name(),'Item3')][@*[starts-with(name(),'Q3')]
= 'Y']

As you can see,

You can't include a wildcard in an XPath query like /Item3*[Q3*="Y"].

is not really true - there are "wildcards" (you don't usually call them wildcards), but you need the right syntax.


Categories : Xml

Related to : How to query XML with complex types
Issue with Complex data types in pig
Pig has three complex types: maps, tuples and bags. These complex types can contain scalar types and other complex types. So, it is possible to have a map where value field is a bag which has a tuple where one of the fields is a map. Map: A map is a chararray to data element mapping which is expressed in key-value pairs. The key should always be of type chararray and can be used as index to acces

Categories : Apache
Query Builder or Closure or DQL, which is the right one for get ride of this complex SQL query with ManyToMany relationship?
When you create a ManyToMany relationship in your entity, Doctrine will generate the third table as mediator between those two entities (named in @ORMJoinTable) with two fields (defined in joinColumns). You do not have direct access to the fields or columns in the third table but they all will be handled by Doctrine in your DQL. This means in your DQL you need to just set the joint table id in you

Categories : Symfony2
Complex join query with query builder
Assuming you have set up your relationships with @OneToMany and @ManyToOne in your entities and you've populated a desired Doctrine collection or array of IDs of countries into $countries: $result = $this->getDoctrine()->getManager()->createQueryBuilder() ->select('c, h, p') ->from('AcmeBundle:Promotion', 'p') ->innerJoin('p.hotels', 'h') ->innerJoin('h.countr

Categories : Mysql
MySQL complex query
You need to use a subquery to compute the maximum value per car, then join the subquery result to the table carrying the car price per car (i.e. car). Each row of the joined result then has the price and the maximum value, from which you can compute (and order by) the ratio. If you only want the highest ratio, then in MySQL (and many other DBMSs) you can limit the results returned to just that r

Categories : Mysql
complex dynamic SQL query, joining on self
You can try this. It works SELECT caseId, MAX(CASE WHEN scanId IN (2,3) THEN scanId ELSE NULL END) AS scanId1, MAX(CASE WHEN scanId=4 THEN scanId ELSE NULL END ) AS scanId2, MAX(CASE WHEN attribute =('A', 'B')THEN attribute ELSE NULL END) AS attribute1, MAX(CASE WHEN attribute IN ('A') THEN attribute ELSE NULL END ) AS attribute2, count(scanId) AS counts FROM

Categories : Mysql
Recently Add
get array result with wsdl and complexType
Same xml element in different places
How to post XML data to plone view and return xml data to sender?
Should a REST service expose a XSD for XML responses?
Querying a log file with multiple XML objects
How to set sorter of a List in Controller in SAPUI5?
XSLT Creating repetitive elements from Complex XML with Field and Metadata ids
and in a xml element
XML Nodes to be inserted with XSLT into a second Stylesheet
wso2 esb smooks un/edifact 96a EDI to XML
A complex type without an element in XSD
Convert rows of spreadsheet to separate XML files
XSLT mapping with metadata and field tags with multiple repetitive elements
Scala - Getting the error scala.xml.NodeSeq
XSLT - get value of all nodes with the same name
XSLT string join error
How do I parse XML web service in Swift?
Creating a complexType from multiple complexTypes
XSL repeating the same value but counting the correct number of different values
trying to export a complex xml from excel 2013
vb.net XML For loop
Chrome 39 XML/XSLT Renders Blank Page
How to make a drop down menu using xslt and xml?
xslt tokenize() and "Not a node item" error
Perl dies on big XML file, using STDIN
How to use custom sorter in XML views
distinct-values, contains function failed
Xslt code for fetching name value basing on the id value given in input
DonĀ“t preload images in XML (google maps API v3)
rename and send all child nodes based on value of element in child node in xslt
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.