Subject: RE: [xsl] Solved -accessing Character Entity's via MSXML parser, in their original form... From: "Julian Reschke" <julian.reschke@xxxxxx> Date: Mon, 29 Oct 2001 10:38:00 +0100 |
Again: It's not "untransformed". It's just hat you forced MSXML to escape the string for you. If the input was "&" you'll still get back "&". > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of > jdgarrett@xxxxxxxxxx > Sent: Monday, October 29, 2001 9:03 AM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Solved -accessing Character Entity's via MSXML parser, in > their original form... > > > Solved -accessing Character Entity's via MSXML parser, in their original > form... > ****************************************************************** > ********** > ***** > > Given the following XML structure .... > > ****************************************************************** > ********* > <?xml version="1.0"?> > <Company> > <AccountNumber Name="Ben & Jerry's" > PhoneNumber="555-1212">123456</AccountNumber> > </Company> > ****************************************************************** > ********* > > where the above XML structure is set to a variable XML1 > > > and the following VB function...using the MSXML parser.... > > ****************************************************************** > ********* > Function RetrieveValue() as String > On Error GoTo errorhandler > > Dim XMLDoc As New MSXML2.DOMDocument30 > Dim selection As MSXML2.IXMLDOMSelection > Dim strValue_1$, strValue_2$, strValue_3$, strValue_4$ > Dim bLoadError% > Dim i% > > i = 0 > bLoadError = XMLDoc.loadXML(XML1) > Set selection = XMLDoc.selectNodes("//AccountNumber") > > strValue_1$ = selection.Item(i).Attributes.getNamedItem("Name").Text > > strValue_2$ = selection.Item(i).Attributes.getNamedItem("Name").xml > > strValue_3$ = > selection.Item(i).Attributes.getNamedItem("Name").firstChild.Text > > strValue_4$ = > selection.Item(i).Attributes.getNamedItem("Name").firstChild.xml > > > FindXMLCharacterEntity = strValue_4$ > > Exit Function > errorhandler: > Resume Next > End Function > ****************************************************************** > ********* > > ..then the following values will be found > > strValue_1$ = Ben & Jerry's > strValue_2$ = Name="Ben & Jerry's" > strValue_3$ = Ben & Jerry's > strValue_4$ = Ben & Jerry's > > and it is strValue_4$ that now finally allows me > to return the value of the Name attribute > as it exists in the XML structure before > it is loaded ....by accessing firstChild.xml .... > > strValue_4$ = > selection.Item(0).Attributes.getNamedItem("Name").firstChild.xml > > > and so I can now finally retrieve the node > attribute value as it exists in the original XML structure .... > > ********************************************************** > ********************************************************** > ********************************************************** > NOTE: "This is all I had wanted to begin with !!" > ********************************************************** > ********************************************************** > ********************************************************** > > or > > given > . > . > . > <SomeNode SomeAttribute="ABC123" SomeOtherAttribute="Ben & > Jerrys">123456</SomeNode> > . > . > . > > > Dim pbError as Boolean > Dim XMLDOC As New MSXML2.DOMDocument30 > XMLDOC.setProperty "SelectionLanguage", "XPath" > pbError = XMLDOC.Load(msXMLFile) > > XMLDOC.selectSingleNode("//SomeNode[@SomeAttribute = > 'ABC123' ]").Attributes.getNamedItem > ("SomeOtherAttribute").firstChild.text > > will return Ben & Jerrys > > vs. > > XMLDOC.selectSingleNode("//SomeNode[@SomeAttribute = > 'ABC123' ]").Attributes.getNamedItem("SomeOtherAttribute").firstChild.xml > > but this will return Ben & Jerrys > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Solved -accessing Charact, Trevor Nash | Thread | [xsl] MSWOrd MSExcel & PDF, P Vikram |
[xsl] different templates, Ingo Friepoertner | Date | RE: [xsl] Can't pass parameters acr, Joerg Pietschmann |
Month |