|
Hi! Unfortunly, our long and winding road is continuing. The Ms .NET XML parser is not finished too. After passing Your successfull example, I tried to pass example of using unparsed entity. I added some entity and it notation in the DTD and some attribute definition of the ENTITY type in the schema. After I added this attribute with the unparsed entity value and executed Your program. The test was ok. But after I assigned to the attribute improper value (not unparsed entity) and test was once again ok! After my tests I have a mind that the parser checks attributes of the ENTITY type as of the the NCName type (the direct ancestor of the ENTITY type). The XML file and schema is here:
Changes.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE change-history [
<!ENTITY eacute "é">
<!NOTATION MyNotation SYSTEM "My Notation">
<!ENTITY MyEntity SYSTEM "My Entity" NDATA MyNotation>
]>
<change-history product="Sample" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="change-history.xsd">
<items>
<item name="Sample.exe">
<version number="2.21.0" entity = "MyEntity">
<change reason="issue 11">Added license to executable.</change>
<change>éFixed bug in executable.</change>
</version>
</item>
</items>
</change-history>
change-history.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="change-history">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="items">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="item">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="version">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="change">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="reason" type="xs:string" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="number" type="xs:string" use="required"/>
<xs:attribute name="entity" type="xs:ENTITY" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="product" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
From other hand, the DTD validation is strict - only unparsed entity can by the value of the ENTITY attribute. For the proving the XML file and C# program is here:
example.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE change-history [
<!ENTITY eacute "é">
<!NOTATION MyNotation SYSTEM "My Notation">
<!ENTITY MyEntity SYSTEM "My Entity" NDATA MyNotation>
<!ELEMENT change-history EMPTY>
<!ATTLIST change-history entity ENTITY #REQUIRED>
]>
<change-history entity = "MyEntity"/>
the program
using System;
using System.Xml;
using System.Xml.Schema;
namespace a
{
class Program
{
static void Main(string[] args)
{
try
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.PreserveWhitespace = false;
XmlValidatingReader reader =
new XmlValidatingReader(new XmlTextReader("Example.xml"));
reader.ValidationEventHandler +=
new ValidationEventHandler(vh);
reader.ValidationType = ValidationType.DTD;
xmldoc.Load(reader);
Console.WriteLine(xmldoc.DocumentElement.Name);
Console.WriteLine("The document has {0} entities", xmldoc.DocumentType.Entities.Count);
Console.WriteLine("Document validated!");
}
catch (XmlSchemaValidationException)
{
Console.WriteLine("Document didn't validate!");
}
}
static private void vh(Object sender, ValidationEventArgs args)
{
Console.WriteLine(args.Message);
throw args.Exception;
}
}
}
Of course, we can use double validation - at begining to use a schema validation and after success to use own validation routine checking the unparsed entities. But IMHO it's not fine decision.
|
|
|
|
|
I get an error
XQuery Execution Error! Unexpected token - "($email, '[A-Z0-9._%+-]+@"
in the following script
xquery version "1.0";
declare function local:valid-email($email as xs:string)
as xs:boolean
{
return matches($email, '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
};
Why does it occur?
Thanks --
Greetings - Jacek
|
|
|
|
|
Doesn't the 'matches' function need a namespace prefix?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
See my post below. That was a pure syntax error.
Greetings - Jacek
|
|
|
|
|
I have been programming in C too long. There is no "return" instruction in XQuery which means "return". It is a part of from(...) statement exclusively.
Solution:
xquery version "1.0";
declare function local:valid-email($email as xs:string)
as xs:boolean
{
matches($email, '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
};
Sorry for not posting the solution earlier.
Greetings - Jacek
|
|
|
|
|
When I try to open xml, that i created myself with IE, i get error: "There was a problem sending the command to the program". With this error showed IE also opens this xml. On the other side when i open it with Firefox, it opens xml without errors. What could be wrong with xml, that IE doesn't open it without errors?
|
|
|
|
|
|
how i can get value of tag
in xml file with C# codes.
example :
i wanna get value of Hello
|
|
|
|
|
class Program
{
class Sample
{
public Sample()
{
string xmlString = "<xml><item>a<!--Item A--></item><item>b<!--Item B--></item><item>b<!--Item C--></item></xml>";
XmlDocument document = new XmlDocument();
document.LoadXml(xmlString);
Console.WriteLine("Method 1");
XmlNodeList nodes = document.SelectNodes("xml/item");
foreach (XmlNode childnode in nodes)
{
if (childnode.LastChild.NodeType == XmlNodeType.Comment)
{
Console.WriteLine(childnode.LastChild.InnerText);
}
}
Console.WriteLine("\n\nMethod 2");
nodes = document.SelectNodes("xml/item/comment()");
foreach (XmlNode childnode in nodes)
{
Console.WriteLine(childnode.InnerText);
}
}
}
static void Main(string[] args)
{
Sample sample = new Sample();
Console.ReadLine();
}
}
Hope it helps!
|
|
|
|
|
I have a few nice xsd files which I want to convert to classes using xsd.exe. All the xsd's have the same includes, like this:
<xs:include schemalocation="FAP.xsd">
<xs:include schemalocation="IVR.xsd">
When I generate a class for each xsd the types declared in these files are duplicated for each original xsd.
Is there any way not to duplicate enums,clasess and etc.
Please assist me.
Regard,
Sri
|
|
|
|
|
Hi All,
I need to Generate controls like Label,Textbox dynamically using XSLT.As I am new to XSLT.I dont know how to get this,Can any one suggest me how can i do this and in how many ways we can get this.
I have to create a control including its properties dynamically like ID,name,textmode etc.. using XSLT code.
Thanks In Advance
|
|
|
|
|
Start here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi.
I have an xml document that im loading to the xmldocument class.
After loading i can see in the innerXML property the xml text.
Using the FirstChild propery gets me the "html" node.
But when im trying to get nodes , any nodes including the "html" node using the "selectNodes" or "selectSingleNode" using XPath, i always get zero nodes;
Example doc.SelectSingleNode("//html") . dosent return any node.
the xml code looks like that :
<br />
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="verify-v1" content="k1br6sikEUd0k3G96/qOGGoQOfCbjtZUn+oT10GDsHc=" /><meta name="keywords" content="lyric, lyrics, song, music, song lyrics, music lyrics" /><meta name="description" content="Lyrics.com is a music community with the largest searchable lyrics database." /><meta name="robots" content="all" /><meta name="server" content="10.1.10.2" /><title>Lyrics.com - your music community with the largest searchable lyrics database.</title><script type="text/javascript" src="http://www.lyrics.com/js/prototype.js"></script><script type="text/javascript" src="http://www.lyrics.com/js/overlay.js"></script><script type="text/javascript" src="http://www.lyrics.com/js/common.js"></script><script type="text/javascript" src="http://www.lyrics.com/js/lyrics.js"></script><script type="text/javascript" src="http://www.lyrics.com/js/users.js"></script><script type="text/javascript" src="http://www.lyrics.com/js/scriptaculous.js"></script><link href="/stylesheets/main.v2.css" rel="stylesheet" type="text/css" /><!--[if IE 7]><link href="/stylesheets/ie7.css" type="text/css" rel="stylesheet" /><![endif]--><!--[if lt IE 7.]><script defer type="text/javascript" src="/js/pngfix.js"></script><![endif]--><!--[if IE 6]><link href="/stylesheets/ie6.css" type="text/css" rel="stylesheet" /><script src="/js/ie6.js" type="text/javascript"></script><script src="/js/pngfix.js" type="text/javascript"></script><![endif]--><!-- --><script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"></script><br />
<br />
.<br />
.<br />
.<br />
. <br />
<br />
</html><br />
Any ideas why?
Thanks
|
|
|
|
|
|
I have a DLL file I have been modifying but I'm stuck.
Inside the DLL are several duplicate xml files,images.............
What I am trying to do is change a reference in the xml file from calling 1 of the bitmaps
embedded in the dll to a folder location with the same named bitmap allowing for changing
the bitmap without editing the dll.
the xml code for referencing the bitmap looks like this
background = "resbmp(12260,7,-1,0,0,1,1)"
12260 being the bitmap name ,7,-1,0,0,1,1 being the dimensions, transparency...
how would I go about changing the resbmp reference to a folder location such as
c:user\Desktop\Images\12260.bmp
I am completely new to xml and I am stumped
|
|
|
|
|
I'm not so expert on xml...
I have 2 xml in 2 different files. (They needs to remain on separate files).
Is there a way to prepare a web page that uses the info from both files?
I found the solution to apply a stylesheet to the first xml to manage the visulization, and I add a code similar to this into the xml to import there also the data from the other file.
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="MyStylesheet.xsl"?>
<!DOCTYPE Document [
<!ENTITY TheOtherXML SYSTEM "File2.xml">
]>
<MyXML>
<
then later I included the other file with a command like:
&TheOtherXML;
...but this way has the problem that works only with IE (not firefox).
Any other way to obtain a similar result?
Russell
|
|
|
|
|
I have xsl file for converting the xml into html.in that xsl,i need query string value.is there any possible to retrieve the value of query string?
|
|
|
|
|
|
Hi guys,
I have a xml document as below and in Xslt I need to get the person name on the basis of email id as in below xml file , contributor node contain email id and associated name is included in Epic node can any body help me to get the name for each contributor through xpath?
<ONIXMessage>
<Product>
<Contributor>
<Email>Rohit@gmail.com</Email>
</Contributor>
</Product>
<Product>
<Contributor>
<Email>Rohit@gmail.com</Email>
</Contributor>
</Product>
<Epic>
<Person>
<Name>Rohit</Name>
<Email>Rohit@gmail.com</Email>
</Person>
</Epic>
</ONIXMessage>
|
|
|
|
|
This XPath will get you the name of the first contributor:
I don't think you can get all the names in one go with XPath.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I really don`t understand schemas namespaces and reading books also not clear my mind. My questions are:
- what's the difference between xmlns and targetNamespace
- if I change the targetNamespace of the schema pointing to one urn of my own all schema, which before was working, start having errors, I thought that targetNamespace point to one opaque urn and taht you can change it?.
- also some books mention that if you are to validate a Xml file with a schema the elements of both files must belong to the sames namespace, but the only way I get validation working is if I don´t set any namespace in the Xml file.
Please could somebody explain me shortly the rules for this schema namespace or some link where it's clearly explained, no so ambiguous explanations as I found until now.
Best Regards
|
|
|
|
|
1. xmlns
xmlns is described here: http://www.w3schools.com/XML/xml_namespaces.asp[^]
We can read there:
When using prefixes in XML, a so-called namespace for the prefix must be defined.
And the example: <h:table xmlns:h="http://www.w3.org/TR/html4/">
The xmlns defines what h prefix means. It must be in the XML document.
2. targetNamespace
You can read about it here: http://www.w3schools.com/schema/el_schema.asp[^]
It's used in XML schemas. We can read there:
targetNamespace - Optional. A URI reference of the namespace of this schema
That's the defference between them.
PS. In the XML schamas there's a line:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
By this xmlns, you define what xs prefix means, so this means that you shouldn't change it.
|
|
|
|
|
Just a open question. I have seen the codes like asp/xml admin to add delete and modify data in an xml. from that I created milti xml files like in an MSaccess where one has multi tables linked by a keyID from table to table, the same way even excel can be linked from sheet to sheet but are still seperate sheets.
That has worked out really well. I have written my own multi-file menu navigation xml that spans over to a record xml to display data and images. that you can see how well over 10,000 images are displayed with around 1000 navigation links at www.wartimepress.com
The next thing I am working towards is making a multi user xml portal database and login. I have one done but took a moment to ponder upgrading my code to aspx. However I have not seen any samples or examples that show how to pass url values where aspx can get them and filter a xml to match and sort via a value.
So many so called examples have been removed from the web, or are becoming outdated. and if one does find a code it mostly is not secure in hidding your file location where a person can reverse hack locations and file structures. also 90% of code examples are sql DB not xml. the last 10% is add delete modify display xml in aspx, but I have not found anything but C or VB examples how to make a pull down or radio buttons and even those codes dont show how to select a value and reload a new xml and filter for say "navy" then display match records with the value passed to a xslt.
Well is apsx all that, or is it still going to take a few years for it to do what asp does already? is you take a look at wartimepress.com you can see where the navigation to the left selects a value from a xml file then via the url redisplay any match records from another file in the content center of the page via xslt.
Thanks if any one has seen aspx code that does the same. and a simple multiuser xml starter code in XML not sql.
--------
my code is in classic asp,
url xml navigation selects "name_value" into a url
that url select string passed to asp to xslt to display records.
---
I also have many other xml cods which randomly display banners and count impressions and clicks show from other site locations where the code has been placed. I have not expanded it to show unique visitor per click from sites yet.
----
I also have another site where I am working on my own genealogy xml standard to display records but the multi user and level access per user is my hold up at the moment.
modified on Friday, December 4, 2009 10:06 PM
|
|
|
|
|
I want create an application which collect Xml Files containig embedded images and create autmaticly a Html Page showing the contained images, I am thinking about XSL.
please any suggestion
|
|
|
|
|
You can use xsl to render your xml in html format very easily.
I didn't understand what do you mean by embedded images.I think xml file would e conaining some relative path of the images and images are in a specified folder on a specific location.
Cheers!!
Brij
|
|
|
|