I'm new to web-services and I encountered a problem. There is a web-service running on JBOSS 6, when on client side we send data with '&' we encounter such error 'The entity name must immediately follow the '&' in the entity reference' ? Couldn't find the solution in web.
Sounds like the server is receiving an XML document; in the strings you send, you (or some agent acting on your behalf) need to escape XML's delimiters (replace '&' with '&' and '<' with '<') before transmission of the message. This has nothing much to do with XSD; it's basic XML syntax.
Related
I am using BouncyCastle 1.8.9 and C# .NET 5.0 to generate a Certificate Signing Request where one of the Organizational Unit values that must go in the subject contains an embedded comma:
OU=BANCO BILBAO VIZCAYA ARGENTARIA, S.A
If this is written verbatim in the dirName, BouncyCastle will correctly throw a "badly formated directory string" ArgumentException. Following the advice from this link, this OU value must be written delimited by quotes, which I have attempted in two different ways:
string subjectTest1 = "OU=\"BANCO BILBAO VIZCAYA ARGENTARIA, S.A\""; // OPTION 1 - Using a string escape sequence
string subjectTest2 = #"OU=""BANCO BILBAO VIZCAYA ARGENTARIA, S.A"""; // OPTION 2 - Using a verbatim string literal
However, when checking the resulting subject name, an additional backslash is being added before the comma:
{OU=BANCO BILBAO VIZCAYA ARGENTARIA\, S.A}
¿Has someone encountered this problem before? If so, ¿how were you able to solve it?
I managed to save file path into DocumentDB.
When i try to search document using C# with particular path, it throw exception from DocumentDB. The path i try to search is "\\Dev4\ete\" as show in Error message.
When i tried to run below query in portal. It successfully return me result.
Anyone faced this issue before? What might be the root cause?
The reason this is failing is because '\' is an escape character.
So, when the backend gets your query of "SELECT * FROM c WHERE c.name = "\\Dev4\ete\" it interprets this as \Dev4\ete\ and then that last \ causes the problem because it is seen as a literal escape character with nothing after it.
You should escape each use of '\' with another '\' i.e.
The example query shown above would be
SELECT * FROM c WHERE c.Name = "\\\\\\\\Dev4\\\\ete\\\\"
Same as if you had the literal \n in your node name you would need to escape out the escape characters of \n
I am checking if a web exception message contains a string I have.
My string is: "The remote name could not be resolved"
The web exception message is:"The remote name could not be resolved:"
You would expect it to work, but if you copy-paste and enlarge the web exception here you will notice tiny dots between every word.
Those dots apparently ruins the contains function I use.
If exWeb.Message.Contains("The remote name could not be resolved") Then
'Do something...
End If
How can I compare those strings without the dots or ignore the dots or any other solution?
Relying on the message string isn't very future proof, as the framework developers may decide to change the message in the future for various reasons (to make it more explanatory, change grammar .etc.) or your code could be running in a different locale with a different language causing the error message to be different.
I suggest you check the Status property instead.
See the documentation of the Enum. I think you're looking for a WebException with a Status of NameResolutionFailure
https://msdn.microsoft.com/en-us/library/system.net.webexceptionstatus(v=vs.110).aspx
I'm in need to retrieve a substring from a text. The text is returned by a device and the problem is it sends it with unknown characters in it. What I'm trying to achieve is to retrieve the value '1' at the end but the XSLT statement would fail due to the JUNK characters(shown as BS and in a vi editor as ^H).
Is there a way I can remove these keystroke characters out of the text and use regular string functions in XSLT?
Any help would be much appreciated.
Thank you guys!
<xsl:value-of select="substring-before('show owp onu next-available port gpon_1/2$nu next-available port gpon_1/2 / 3 : 81.' , '.')"/>
If your data contains a Backspace control character then it isn't legal XML, and if it isn't legal XML then you can't process it using XSLT. You have to deal with the problem at the stage when you are turning the text returned by the device into XML.
I use a Servlet to stream an image from the database and I use the tag for display as follows:
<h:graphicImage url=”/servletUrl?para1=name1¶2=name2”/>
The problem starts if I include the 2nd parameter (¶2=name2) and I get the following error message:
The reference to entity "para2" must end with the ';' delimiter
Am I missing anything?
The ampersand & is actually an special character in XML. The ampersand is to be used to indicate the start of a XML entity like >, < and so on. Hence the exception message that it is expecting a ; which indicates the end of a XML entity.
To represent a standalone ampersand, you need to represent it as &.
<h:graphicImage url="/servletUrl?para1=name1¶2=name2" />
(note that I fixed the invalid curly quotes as well)