f

#### problem with child text node when constraining other child node types

I'm struggling with whether or not it is possible to represent the
following construct in a dtd.

I have an element X that I want to contain 3 types of child elements.
Child Element A should have a 0 or 1 constraint, Child element B should
have a 0-n constraint. I also want X to be able to contain text,
resulting in xml that the following

<X>
<A/>
<B/>
<B/>
child text of element X also possible
</X?>

I've got the following, but can't seem to figure out a way to also
allow for a text child node. Any help appreciated

<!ELEMENT X (A?, B*)>

Bryan


 0
bax (3)
5/17/2006 2:24:06 PM
comp.text.xml 8781 articles. 0 followers.

6 Replies
530 Views

Similar Articles

[PageSpeed] 57

Bryan Ax wrote:
> I've got the following, but can't seem to figure out a way to also
> allow for a text child node. Any help appreciated

Declare X as having mixed content.
http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-mixed-content

 0
5/17/2006 2:27:57 PM
Looking at this, I don't see a way to constrain it so that A only can
appear once, whereas B can appear multiple times...I think I'm missing
something.


 0
bax (3)
5/17/2006 2:36:00 PM
Upon further reading, there doesn't appear to be a way to do this.
Either I go to mixed-content, which is less constraining, or I need to
add a child node to hold the text element.

http://www.devguy.com/fp/XML/dtd.htm


 0
bax (3)
5/17/2006 2:56:16 PM

Bryan Ax wrote:

> I have an element X that I want to contain 3 types of child elements.
> Child Element A should have a 0 or 1 constraint, Child element B should
> have a 0-n constraint. I also want X to be able to contain text,

All you can do with mixed contents is described here
<http://www.w3.org/TR/REC-xml/#sec-mixed-content>
So you could have
<!ELEMENT X (#PCDATA | A | B)*>
which would define the possible child elements (A, B) but does not allow
you to constrain their number.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 0
mahotrash (2052)
5/17/2006 3:29:54 PM
Bryan Ax wrote:
> Looking at this, I don't see a way to constrain it

That's correct. Mixed content in DTDs doesn't allow constraining the
number or order of instances of child elements, only their types. Live
with that and constrain it in your application code, or switch from DTDs
to schemas, or (as you suggest) move the text into an element.

 0
5/17/2006 4:11:50 PM
Bryan Ax wrote:
> I'm struggling with whether or not it is possible to represent the
> following construct in a dtd.
>
> I have an element X that I want to contain 3 types of child elements.
> Child Element A should have a 0 or 1 constraint, Child element B should
> have a 0-n constraint. I also want X to be able to contain text,
> resulting in xml that the following
>
> <X>
> <A/>
> <B/>
> <B/>
> child text of element X also possible
> </X?>
>
> I've got the following, but can't seem to figure out a way to also
> allow for a text child node. Any help appreciated
>
> <!ELEMENT X (A?, B*)>

You can't do this in XML, only in SGML.
The content model in SGML would be

<!element x - - (a?,b*,#pcdata)>

but the XML spec says in Mixed Content, #PCDATA must come first,
and in any case cannot be used in a sequence group.

Is there a reason why this model should use Mixed Content? It's
normally only used for text documents, where the separator is
the vertical bar, eg <!ELEMENT X (#PCDATA|A|B)*> (like HTML
paragraphs). As you need to provide 0/1 and 0/+ constraints,
it looks like you are modelling data, not text. In that case,
put the text in a container, eg

<!ELEMENT X (A?,B*,C)>
<!ELEMENT C (#PCDATA)>

This will be much more robust, easier to process, and avoids
any unpleasantness with line-ends in pernicious mixed content.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

 0
Peter
5/17/2006 9:08:55 PM

Similar Artilces:

select nodes with child node A and child node B
I have an XML document that has multiple childe nodes like the one at the end of this message What syntax would I use with selectNodes to select all viewentry nodes that have an entrydata child node with a name attribute equal to "CourseOrMeetingName" that has a text childe node with the text Course ABC AND that also have an entrydata child with a name attribute equal to Start Date that has a datetime child node with the text 20070110 I was trying something like //viewentry[ (entrydata[@name='CourseOrMeetingName'][text='Course ABC']) and (entrydata[@name='StartDate'][datetime='20070110'])]" <viewentry position="1" unid="E5FE575692CAB4CD852572140052F751" noteid="893A" siblings="24"> <entrydata columnnumber="0" name="CourseOrMeetingName"> <text>Course ABC</text></entrydata> <entrydata columnnumber="1" name="StartDate"> <datetime>20070110</datetime></entrydata> <entrydata columnnumber="2" name="City"> <text>West chester</text></entrydata> <entrydata columnnumber="3" name="FirstName"> <text>Joe</text></entrydata> <entrydata columnnumber="4" name="MiddleName"> <text></text></entrydata> <entrydata columnnumber="5" name="LastName"> <text>...

need a help to create XML node with text and sub child.
Hi folks I need a help to create XML node with text and sub child. -------------------------------------------------------- I want to create "ADDR" node with text and child node. (First child node and then text.) <?xml version="1.0" encoding="UTF-8" ?> - <ROOT> - <NODE> <child-1 attr="attr-value">This is child text</child-1> - <ADDR> <postcode>12345</postcode> Address information </ADDR> </NODE> </ROOT> -------------------------------------------------------- I can create "ADDR" node with text and child node. But first text and then child node. I can not change the location of text and child node of "ADDR" node. <?xml version="1.0" encoding="UTF-8" ?> - <ROOT> - <NODE> <child-1 attr="attr-value">This is child text</child-1> - <ADDR> Address information <postcode>12345</postcode> </ADDR> </NODE> </ROOT> ------------------------------------------------------------------------------------ This is code which I did (ASP) ------------------------------------------------------------------------------------ Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM") If (xmlDoc.childNodes.length = 0) Then Set objProcInstr = xmlDoc.createProcessingInstruction("xml", "version=""1.0"" encoding...

Get XML values from nodes and child nodes
Hi everybody. My XML file is: <Locatore> <NumeroProgressivo>001</NumeroProgressivo> <CodiceFiscale>CSTNDA69P90H523R</CodiceFiscale> <PersoneFisiche> <Cognome>CAST</Cognome> <Nome>NADIR</Nome> <Sesso>F</Sesso> <DataNascita>10091979</DataNascita> <ComuneNascita>RONCA</ComuneNascita> <ProvinciaNascita>BL</ProvinciaNascita> </PersoneFisiche> </Locatore> <Locatore> <NumeroProgressivo>002</NumeroProgressivo> <CodiceFiscale>PRSGRI74L29F443L</CodiceFiscale> <PersoneFisiche> <Cognome>PERISSI</Cognome> <Nome>IGOR</Nome> <Sesso>M</Sesso> <DataNascita>29071970</DataNascita> <ComuneNascita>MONTE</ComuneNascita> <ProvinciaNascita>SA</ProvinciaNascita> </PersoneFisiche> </Locatore> I need to get in ONE RECORD, both node value and his child nodes values, like this 001 | CSTNDA69P90H523R | CAST | NADIR | F | 10091979 | RONCA | BL 002 | PRSGRI74L29F443L | PERISSI | IGOR | M | 29071970 | MONTE | SA ..... With this: SELECT X.valore.query('NumeroProgressivo').value('.', 'VARCHAR(20)') as NumeroProgressivo, X.valore.query('CodiceFiscale').value('.', 'VARCHAR(16)') as CodiceFiscale FROM Tbulk CROSS APPLY Tbulk.nodes('Fornitura/Documento/S...

Problem updating an attribute that appears in both root node and child node!
Hi I have an attribute the appears in both the root node and child node for example, below the attribute VERSION appears in the rood node (PRODMSG ) and a child node (OPERATION ) ================ INPUT XML ================ <?xml version="1.0" encoding="utf-16"?> <PRODMSG VERSION="1.2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="00051004_20070503024353"> <HEADER> <OPERATION NAME="PRICE" VERSION="1.2"> <USERNAME>SMITGHJ</USERNAME> <HOSTNAME>00051004</HOSTNAME> <DATETIME>2007-05-03T01:30:16.710</DATETIME> </OPERATION> </HEADER> </PRODMSG> However all I want to do is update the root node (PRODMSG) VERSION attribute to 2.0 but leave the child node version untouched. Problem is if I select the PRODMSG and it's attributes and update the version to 2.0 ....... <xsl:template match="@VERSION|PRODMSG"> <xsl:attribute name="VERSION">2.0</xsl:attribute> </xsl:template> ...... I get nothing but if I do this ....... ================ TRANSFORM ================ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"> <xsl:output method="xml" version=&...

XSLT Select nodes without text-node children whose names starts with specifix text
Question on XSL expression Got this XML: <Body> <Page> <Line no="9" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="10" detail="true"> <onefield>onefieldstext</onefield> <fgman9>fgmanfieldstext</fgman9> <twofield>twofieldstext</twofield> </Line> <Line no="11" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="12" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="13" detail="true"> <onefield>onefieldstext</onefield> <fgman5>fgmanfieldstext</fgman5> <twofield>twofieldstext</twofield> </Line> <Line no="14" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> </Page> </Body> I would select the <Line/> nodes without text-node children whose names is starting with "fgman" - in this example it is all <Line/> _except_ <fgman9/> and <fgman5/> in <Line/> with @no of 10 and 13. I know that this works: &...

Why treat text nodes as nodes?
One of the things I find most unnatural about most XML APIs is that they try to abstract both elements and text into some kind of "node" object when they have virtually nothing in common. The reason these APIs do it is to make it possible for both text and elements to be children of elements. But there is another way. The XPath/XQuery data model does not allow two consecutive text nodes. As far as I can tell, most XML processing software automatically merges consecutive text nodes. This means that the number of text segments directly under an element is bound by the number of sub-elements plus 1 (PIs and comments may be treated as "pseudo-elements" for this purpose). As a result, it is always possible to associate each text segment with the element immediately preceding it within the parent and associate the first text element with the parent itself. No more text nodes. The only API I know that uses this trick is the ElementTree API for Python by Fredrik Lundh (http://effbot.org/zone/element-index.htm). Each Element object has a text and tail property for the text immediately inside the element and text following it within its parent element. Elements always have a tag, attributes and and zero or more children - which are always other elements. No mixed types. The text and tail attributes are always strings. This model should be very convenient for statically-typed languages like Java or C++. I find it ironic that this idea is probably used only in Pyt...

xsl variable $node/text() but$node can non-node-set help!
I have a variable $value as a parameter in the following template: <xsl:template name="myTemplate"> <xsl:param name="value"/> <xsl:if test="$value"> <xsl:value-of select="$value"/> </xsl:if> </xsl:template> Now i call myTemplate sometimes whit the a parameter$value that is sometimes a text node, and sometimes it is not even a node. Example: <inputDoc> <a>hello</a> <a/> </inputDoc> xsl: <xsl:for-each select="/inputDoc/a"> <xsl:call-template name="myTemplate"> <xsl:with-param name="value" select="./text()"/> </xsl:call-template> </xsl:for-each> So i call myTemplate with parameter $value=a/text() But for the second <a> element in <inputDoc> there is not text() node. This gives me the following error: Cause: javax.xml.transform.TransformerException: The value is not a node-set With line number of the error pointing to the xsl:if in myTemplate. No i tried the function nilled(), but that is XPath 2.0, i only use XPath 1.0 and XSL 1.0 i know a possible solution is this: <xsl:for-each select="/inputDoc/a"> <xsl:choose> <xsl:when test=".[not(node())]"> <xsl:call-template name="myTemplate"> <xsl:with-param name="value" select="false()"/> </xsl:call-template> <... Problems with node text Hello, I have a problem with the text positioning around nodes. When using the following code \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=0.5] \node[draw,shape=circle] (a) at (-20,20) {test}; \node[draw,shape=circle] (b) at (0,0) {my circle}; \end{tikzpicture} \end{document} The code appears on the node topmost node (b), whenever I swap the node position, it seems that all text is placed with the lower-left most node. I have not a clue what causes this, but all nodes do this, even examples from fauskes.net and examples from several other sources, including the pgf manual. Also, the same problem occurs with labels around nodes I use this on the latest version of Ubuntu through Kile, but the command line compilation also fails. I have pgf 2.0 by the way. Regards, Jewan I use pgf/tikz, but I don't know what you mean by "swap the node" or what you expect to see that is different from what this produces. Maybe post another minimal example that looks bad or different, or describe the problem more precisely (or both). On Apr 4, 10:24 am, "mj.vandenb...@gmail.com" <mj.vandenb...@gmail.com> wrote: > Hello, > > I have a problem with the text positioning around nodes. When using > the > following code > > \documentclass{article} > \usepackage{tikz} > > \begin{document} > > \begin{tikzpicture}[scale=0.5] > \node[draw,shape=circle] (a) at (-20,20) {test}; > \node[... XSLT Child node of a specific node Hi All, I would like to use XSLT to replace all <u> nodes that are children of a <b> node with a new <heading> node. Also, if the <b> node has no other children than remove it as well. For example: This would be some <b><u>Text</u></b>. It could <b> also maybe be like <u>this</u>...</b> to This would be some <heading>Text</heading>. It could <b> also maybe be like <heading>this</heading>...</b> I've been trying something like: <xsl:template match="//b[u]"> ... </xsl:template> with no success. Could someone point me in the right direction? Thanks! On 2006-10-20, gregmcmullinjr@gmail.com <gregmcmullinjr@gmail.com> wrote: > Hi All, > > I would like to use XSLT to replace all <u> nodes that are children of > a <b> node with a new <heading> node. Also, if the <b> node has no > other children than remove it as well. > For example: > > > This would be some <b><u>Text</u></b>. It could <b> also maybe be like ><u>this</u>...</b> > > to > > This would be some <heading>Text</heading>. It could <b> also maybe be > like <heading>this</heading>...</b> > > I've been trying something like: > ><xsl:template match="//b[u]"> > ... ></xsl:template&... Text nodes and element nodes query Hi all, The code below gets me a list of all the nodes within the node object called xml_tags_root. NodeList nl = xml_tags_root.getChildNodes(); The length of nodelist I get is double the number of actual elements! This is because after every element node there is text node which is (I think) the whitespace in the XML document. Is there a way to get only the element nodes? Please advice. thanks, ASD Hi, Look at getElementsByTagName(....) Regards, Arnaud "asd" <arvindsd@yahoo.com> a �crit dans le message news: 1116833345.887839.95270@g47g2000cwa.googlegroups.com... &... XML DOM: XML/XHTML inside a text node In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us... How do I restrict the type of a text node in a mixed, complex-type element? Hi, I would like to use xsd to restrict the text in a mixed, complex-type element. My reading so far seems to say that it is not achievable, is this true? I find it hard to imagine. For example, in <foo> some text <bar>some more text</bar> </foo> I know I must define foo as an element with a complex type that is mixed. I also know that restricting the text of <bar/> is relatively easy, but I cannot find any reference that tells me how to restrict the text of <foo/>, in this case the current value is "some text". Thanks in advance, Chishun Kwong ... Extracting the first child node of a parent node Hei, I have the following xml file and I have tried to write xslt to extract only the values of the first "record" node. It does not work. I need some help. I used ---- to represent indent. Xml: <?xml version="1.0" encoding="UTF-8"?> <OAI-PMH xmlns="http://www.openarchives.....OAI/2.0/OAI-PMH.xsd"> ---<responseDate>2008-02-19T12:54:06Z</responseDate> ---<request xmlns="" verb="ListRecords" ......o.no</request> ---<ListRecords xmlns=""> -----<record> <!----the first record node I want to extract --> -------<header> ----------<identifier>oai:frida.uio.no:110517</identifier> ----------<datestamp>2004-12-16</datestamp> ----------<setSpec>UITT</setSpec> -------</header> ..... -----</record> <!-- end of the first record node I want to extract ---> -----<record> .......... -----</record> ........... ---</ListRecords> </OAI-PMH> xslt: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"> <xsl:template match="/ListRecords" > <xsl:apply-templates select="child::node()[1]"/> </xsl:template> <xsl:template match="record"> <xsl:value-of select="*" /... How to find non-existing nodes or nodes with no text Ok, this must be simple but the more i search the more i don't find. It's about SimpleXML and PHP. How to find non-existing nodes or nodes with no text My XML file looks a little bit like this: i.e. 1 <discography> <CD> <title></title> <year>1978</year> </CD> </discography> i.e. 2: <discography> <CD> <year>1978</year> </CD> </discography> In i.e. 1, the tag <title> is empty. How do i test for empty tags in PHP? In i.e. 2, the tag <title> doesn't even exist. How do i ... Selecting Nodes Using Subtotal of Child Nodes I'm having difficulty finding the correct syntax that will allow me to select a group of invoices based on the total of an amount column located in its line items. Below are simplified examples of my XML and XSLT files: XML FILE <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="OutstandingInvoiceBalances.xslt"?> <ProgramData> <Invoices> <InvoiceID>1</InvoiceID> <InvoiceNumber>100</InvoiceNumber> <Amount>1000.00</Amount> </Invoices> <Invoices> <InvoiceID>2</InvoiceID> <InvoiceNumber>101</InvoiceNumber> <Amount>2000.00</Amount> </Invoices> <Invoices> <InvoiceID>3</InvoiceID> <InvoiceNumber>102</InvoiceNumber> <Amount>3000.00</Amount> </Invoices> <InvoiceLineItems> <InvoiceLineItemID>1</InvoiceLineItemID> <InvoiceID>1</InvoiceID> <AmountToPay>0</AmountToPay> </InvoiceLineItems> <InvoiceLineItems> <InvoiceLineItemID>2</InvoiceLineItemID> <InvoiceID>2</InvoiceID> <AmountToPay>100</AmountToPay> </InvoiceLineItems> <InvoiceLineItems> <InvoiceLineItemID>3</InvoiceLineItemID> <InvoiceID>2</InvoiceID> <AmountToPay>200</AmountToP... extracting text from an XML node Hi, suppose i get the simple xml sample: <foo> 1 <bar>2</bar> 3 </foo> Now suppose i want to extract all the text of only the 'foo' node, ie expected result is '1 3'. I tried both <xsl:template match="foo"> <xsl:value-of select="text()" /> </xsl:template> and <xsl:template match="foo"> <xsl:value-of select="." /> </xsl:template> but the former lead to '1' and the latter to '1 2 3' (using xsltproc & firefox). What did i missed ? thanks, -Nicolas nicolas.edel@gmail.com wrote: > Now suppose i want to extract all the text of only the 'foo' node That isn't a built-in concept; you have to recast it as "all the text nodes which are immediate children of the 'foo' node". (The built-in text value of an element, as you discovered, is the value of all text contained in it, directly or indirectly). Note too that the whitespace (line breaks and indentation) will be part of the the text nodes unless you explicitly strip that away. <xsl:value-of select="text()" /> didn't work because value-of returns the contents of only the first matching node. This is one case where xsl:for-each is appropriate, to explicitly iterate through the text children. -- Joe Kesselman / Beware the fury of a patient man. -- John Dryden On Nov 30, 12:34 am, Joseph Kesselman <kesh... text node has text but won't render This renders in Firefox perfectly well but the text in the red box remains invisible. The program is a subset of a larger and doesn't do much. but even after cutting out all the unneccessary stuf, I still can't get it to work!! Cheers, Greg =================== <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" > <xhtml:head> <xhtml:title> Intermingled XHTML and SVG </xhtml:title> <xhtml:script type="text/javascript" language="JavaScript"><![CDATA[ function gogo(evt){ var targetObj = evt.target; //The object that received the event var targetDoc = targetObj.ownerDocument; //Owner document var wg = document.getElementById("SVGroot"); var lg = document.getElementById("labelz"); //label labelBox= targetDoc.createElementNS("http://www.w3.org/2000/svg", "svg:rect"); labelBox.setAttributeNS(null, "id", "label1"); labelBox.setAttributeNS(null, "fill", "red"); labelBox.setAttributeNS(null, "fill-opacity", 1); labelBox.setAttributeNS(null, "x", 700); labelBox.setAttributeNS(null, "y", 400); labelBox.setAttributeNS(null, "width", 200); labelBox.setAttributeNS(null, "height", 20); labelBox.setAttributeNS(null, "visibility", "visible"); lg.appendC... Getting kind of abstract text snippets from text nodes Hi everybody, I am about implementing a little search engine that searches a phrase over xml text nodes. I got that all working fine but what I want as the results is not the complete text of the textnode, I would like to make an abstract like result list (such output that you get with google searches. For eg .... I am the <b>substring</b> from a complete text node ... where "substring" is the search term. The problem is simple (I think): I want to extract all the text parts of the complete text node, where search searchterm is highlighted, surrounded by the text like 30 characters. I found an intersting post "cut down text" which is almost that what I am looking for, but there the text is just trimmed by x characters. Is anybody here, that has an "elegant" way to solve that or some hints that get me to the solution? I am not able to use regex (would be nice though) My parser is Sablotron so I am restricted to the functions that I get. (1.0). Any help is greatly appreciated. regards, Andreas W Wylach Think about dividing the text into three parts: before your target, the target itself, and after the target. Process each appropriately. If you want to report multiple instances within the same block of text, look at the standard examples of recursive text processing. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry "Andreas W. Wylach" <aw@ioc... XSL select only nodes which contain a specific child node Given the following extremely simplified XML... <AA> <BB></BB> <BB><CC>foo</CC></BB> <BB></BB> <BB><CC>bar</CC></BB> </AA> ....is there an easy way to use and XSL select to get only the <BB> nodes which have a <CC> child node? <xsl:for-each select="AA/BB"> Gives me 4 nodes: <BB></BB> <BB><CC>foo</CC></BB> <BB></BB> <BB><CC>bar</CC></BB> <xsl:for-each select="AA/BB/CC"> Gives me 2 nodes, but it's at the CC level and I need it to be at the BB level because there's a bunch of other nodes there that need to be processed as well. <CC>foo</CC> <CC>bar</CC> I'm thinking that there must be some sort of conditional select XPATH that will get me what I need: <BB><CC>foo</CC></BB> <BB><CC>bar</CC></BB> Any tips? William Krick wrote: > Given the following extremely simplified XML... > > <AA> > <BB></BB> > <BB><CC>foo</CC></BB> > <BB></BB> > <BB><CC>bar</CC></BB> > </AA> > > ...is there an easy way to use and XSL select to get only the <BB> > nodes which have a <CC> child node? > > <xsl:for-each select="AA/BB"> ... text-text Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ... XML Schema for Node with attribute and text I've tried to find how to write a schema for this type of node everywhere. <Param name="FirstParam">ABCD</Param> How do i arrange a complex type that contains an attribute and a text. This : <xs:complexType name="Param"> <xs:attribute name="name" /> </xs:complexType> Result as : <invalid char="13" code="cvc-complex-type.1.2" line="3086" resource="file:///C:/WINNT/Profiles/svaillan/Desktop/XML Schema/test.xml">element Param must be empty but is not</invalid> This : <xs:complexType name="Param"> <xs:all> <xs:element name="text" type="xs:string" /> </xs:all> <xs:attribute name="name" /> </xs:complexType> Result as : <invalid char="13" code="cvc-complex-type.1.2.3" line="3086" resource="file:///C:/WINNT/Profiles/svaillan/Desktop/XML Schema/test.xml">text not allowed: |ABCD|</invalid> I just dont know where to add the unnamed <xs:element ... > tag. Anyone can help me figure this out? Thx In article <de3c2ad2.0311281339.e74b69b@posting.google.com>, Simon Vaillancourt <svaillancourt@mediagrif.com> wrote: % I've tried to find how to write a schema for this type of node % everywhere. % % <Param name="FirstParam">ABCD</Param> % % How do... text + text What is "text + text" supposed to do right now? It doesn't seem very useful to me. What about making "text + text" as an equivalent for "text || text"? Most strongly-typed programming languages do this. And MS SQL Server too, I think (CMIIW). -- dave ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond: > What is "text + text" supposed to do right now? Nothing. > What about making "text + text" as an equivalent for "text > || text"? Most strongly-typed programming languages do this. And MS SQL > Server too, I think (CMIIW). What would this gain except for bloat? It's not like SQL is utterly compatible with any programming language; users will still have to learn all the operators anyway. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match Peter Eisentraut wrote: >>What is "text + text" supposed to do right now? > > Nothing. Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly, the current behaviour is quite strange to me. ------------------ =... Problems with getting text from node (xalan) I have a node that I'd call a text node, but the parser disagrees. At any rate, I'd like to get the text out of it. (It is some text with infrequent markup. I'm using Xalan and Java. getNodeValue() returns null, and isTextNode(n) returns false. Here is the only code I've been able to use to get the text out: ByteArrayOutputStream baotc = new ByteArrayOutputStream(); StreamResult out = new StreamResult(new OutputStreamWriter(baotc)); serializer.transform(new DOMSource(n), out); String tt = baotc.toString(); It actually gives the text but has a jarbled(to me) footer and header. I'm doing something wrong of course. Thanks for your help. LNMEgo (btw, I did post this on the forums at sun, but didn't get a response. so, yes I did cross post, but that forum is pretty unresponsive. thanks) I realized that it was due to another line of code that I have since fixed. Thanks to anyone who had tried to think of a solution. -LNMEgo LNMEgo@hotmail.com (Jeff) wrote in message news:<ce9e21d9.0309202308.25c42a2a@posting.google.com>... > I have a node that I'd call a text node, but the parser disagrees. At > any rate, I'd like to get the text out of it. (It is some text with > infrequent markup. > > I'm using Xalan and Java. getNodeValue() returns null, and > isTextNode(n) returns false. Here is the only code I've been able to > use to get the text out: > > ByteArrayOutputStream baotc = new ByteArr... editor for editing xml text nodes We have xml documents which contain text imbedded as text content in some xml structures. These documents need to be translated by human translators from English into, for example, Chinese. We would like the translator to use an editor which shows him only the text content of the xml document, or gives him only editing access to the text content. The translator should be unable to touch or modify the xml tags, so that it is guaranteed that the xml-tags are unchanged when the translator returns the translated document. The translator simply replaces all English text accessible to him into Chinese text. Does anyone know an xml editing tool which has this feature, of allowing only modification to the text node content? Alois Zreindl wrote: > We have xml documents which contain text imbedded as text content in > some xml structures. > > These documents need to be translated by human translators from English > into, for example, Chinese. > > We would like the translator to use an editor which shows him only the > text content of the xml document, or gives him only editing access to > the text content. I am working on exactly this right now. It leaves the elements in element content inviolable, but allows element markup in mixed content (the only thing a translator should be touching). Please contact me by email to discuss this further. > The translator should be unable to touch or modify the xml tags, so that > it is guara... Web resources about - problem with child text node when constraining other child node types - comp.text.xml Are you constraining your back office performance? Imagine a world where every task of every employee was measured in real-time. Lack of Staff Resources Constraining BPM Investment Benefits: Survey Suggests Australia Lagging US and ... CSO Australia - News, Industry Blogs, Tools and Resources for Data Security Executives Apple record 2 million+ iPhone 5 preorders constraining supply Nathan Mattise Apple announced on Monday that it has taken over 2 million preorders for the iPhone 5 with the first 24 hours of availability. ... HTC says Samsung is constraining its component supply as a ‘competitive weapon’ HTC's latest flagship Android phone, the HTC One , has been a big success for the struggling smartphone vendor. The company confirmed recently ... India's Bizarre Rules Constraining Amazon's and Flipkart's Activities Amazon has just committed a further$2 billion of investment to the Indian market and Flipkart, a home grown competitor, has raised \$1 billion ...

Apple Constraining iPod, iPad Mini 2 and iPad Air Inventory Sent to Third-Party Retailers
Insider inventory constraint information from major retailer Target hints at some possible end of life timelines for various products like the ...

Constraining Predation: Formal and Informal Institutions
... quality of available measures of informal rules, this work is building a case that cultural norms do much heavy lifting when it comes to constraining ...

Constraining Obama
Does the president wish he weren’t so constrained by the system the Founders put in place so very long ago?

Indebted firms constraining bank lending - RBI report
The ability of India's debt-burdened firms to repay their debts has worsened as leverage has increased, straining a banking sector burdened by ...

Constraining world trade is unlikely to help the climate, study finds
From rubber dinghies to television sets: the emissions of greenhouse gases in countries like China are to a significant extent caused by the ...

Resources last updated: 3/13/2016 10:48:52 PM